#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>

int main()
{
    int fa;
    fa = open("test_c1.txt",O_WRONLY|O_CREAT|O_TRUNC,0664);
    if(fa == -1)
    {
        perror("fail to open");
        return -1;
    }
    ssize_t wr;
    if((wr = write(fa,"hello world\n",12))==-1)
    {
        perror("fail to write");
        return -1;
    }
    printf("wr = %ld\n",wr);
    write(fa,"cyyyds!\n",8);

    close(fa);
    return 0;
}